package com.wondertek.poms.dao.po;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.wondertek.poms.common.constant.CurrentUser;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.Proxy;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * @author evan0213
 * @description
 */
@Data
@Entity
@Table(name = "pc_prd_info_rate_charge")
@DynamicUpdate
@DynamicInsert
@Proxy(lazy = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PcPrdInfoRateCharge {
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PRDINFO_RATE_CHARGE_ID")
	@SequenceGenerator(name = "SEQ_PRDINFO_RATE_CHARGE_ID", sequenceName = "SEQ_PRDINFO_RATE_CHARGE_ID", allocationSize = 1)
	private Long id;

	/**
	 * <b>Fields</b> prdInfoId : 商品包ID
	 */
	@Column(name = "prd_info_id")
	private Long prdInfoId;

	/**
	 * <b>Fields</b> chargePointId : 计费ID
	 */
	@Column(name = "charge_point_id")
	private Long chargePointId;

	/**
	 * <b>Fields</b> equityId : 权益节点id
	 */
	@Column(name = "equity_id")
	private Long equityId;

	/**
	 * <b>Fields</b> channelPackageId : 渠道包ID
	 */
	@Column(name = "channel_package_id")
	private Long channelPackageId;

	/**
	 * <b>Fields</b> chargeType : 计费类型 1:基本计费 2 促销计费 3 下载收费 4 码率收费
	 */
	@Column(name = "charge_type")
	private Integer chargeType;

	/**
	 * <b>Fields</b> price : 价格
	 */
	private String price;

	/**
	 * <b>Fields</b> rateLabel : 收费码率 1:高清收费 2:4K收费
	 */
	@Column(name = "rate_label")
	private String rateLabel;

	/**
	 * <b>Fields</b> createdBy : 创建人
	 */
	@Column(name = "created_by")
	private String createdBy;

	/**
	 * <b>Fields</b> createdTime : 创建时间 YYYY-MM-DD HH24:MI:SS
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "created_time")
	private java.time.LocalDateTime createdTime;

	/**
	 * <b>Fields</b> updatedBy : 更新人
	 */
	@Column(name = "updated_by")
	private String updatedBy;

	/**
	 * <b>Fields</b> updatedTime : 更新时间 YYYY-MM-DD HH24:MI:SS
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@Column(name = "updated_time")
	private java.time.LocalDateTime updatedTime;

	/**
	 * <b>Fields</b> remarks : 备注
	 */
	private String remarks;

	/**
	 * <b>Fields</b> deleted : 是否删除 1:是 0:否
	 */
	private Integer deleted = 0;

	public static void putTimeAndUser(PcPrdInfoRateCharge pcPrdInfoRateCharge) {
		if (pcPrdInfoRateCharge.id == null) {
			pcPrdInfoRateCharge.setCreatedBy(CurrentUser.currUserName());
			pcPrdInfoRateCharge.setCreatedTime(java.time.LocalDateTime.now());
		}
		pcPrdInfoRateCharge.setUpdatedBy(CurrentUser.currUserName());
		pcPrdInfoRateCharge.setUpdatedTime(java.time.LocalDateTime.now());
	}
}
